package com.tianxiabuyi.model.task;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 任务执行类，
 * Created by yanghaixiao on 2017/6/12.
 */
public class TaskExecutor {
    static final Integer TREAD_MAX_COUNT = 10;
    static final ExecutorService fixedThreadPool = Executors.newFixedThreadPool(TREAD_MAX_COUNT);
    public static void execute(List<AbstractTask> list) {
        for (AbstractTask task:list) {
            fixedThreadPool.execute(task);
        }
    }
    public static void execute(AbstractTask task) {
        fixedThreadPool.execute(task);
    }
}
